/***************************************************************************
 *   Copyright (C) 2009 by MJ   *
 *   hanfman_cool@web.de   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

//mani.cpp - is a part from steamserverutil by MJ
//steamserverutil.googlecode.com

//mani.cpp handles the functions for the mani admin plugin

#include <iostream> //for cout and cin
#include <fstream> //for ifstream and ofstream
#include <stdlib.h> //for system()	
#include <string.h> //for strcpy, strcat and strcmp

//#include "mani.h"
#include "steamserverutil.h"
#include "conf_server.h"

//to make the differance of the arrays better 
#define OFF_N 0
#define OFF_C 1



using namespace std;

//function which tests if the server is really installed, if it is installed it saves the path in the char param[]
void mani_test(unsigned short int choice)
{
	if (choice > 5)
	{
		cout << "\n\nServer is not supported by mani admin plugin!!\n\n";
		return;
	}
	
	if (choice == 3) //gmod
		cout << "\n\nNote that this server isn't officially supported by mani admin plugin\n";
	
	strcpy(param, workdir);
	
	switch(choice)
	{
		case 1:	if(server_css==true)
		{
						
			strcat(param, "/servers_source/cstrike");
			installed = true;
		}
		else
			not_installed();
		break;
		case 2:	if(server_dods==true)
		{
			strcat(param, "/servers_source/dod");
											
				
			installed = true;
		}
		else
			not_installed();
		break;
		case 3:	if(server_garrysmod==true)
		{
			strcat(param, "/servers_source/garrysmod");
						
									
			installed = true;
		}
		else
			not_installed();
		break;
		case 4:	if(server_hl2mp==true)
		{
			strcat(param, "/servers_source/garrysmod");
						
									
			installed = true;
		}
		else
			not_installed();
		break;
		case 5:	if(server_tf==true)
		{	
			strcat(param, "/servers_source/tf");
					
			installed = true;
		}
		else
			not_installed();
		break;
		default: cout << "\n\nTry again ;)\n\n";
		break;
	}
}

void install_mani()
{
	cout << "\n\nIn which server do you want to install mani admin plugin?\n\n";

	unsigned int choice;

	if(!is_installed())
		return;

	cout << "\n : ";

	char params[300]; //the hole command is saved here

	cin >> choice;
	cin.ignore();



	strcpy (params, "cd "); //because in function mani_test the "cd " is not included

	//if it is really installed	
	installed = false;
	mani_test(server[choice]);
	strcat(params, param);
	//-------end---------(modified)


	if(installed==true)
	{
		if (server[choice]==5)
		{
			
			cout << endl << endl << "Downloading mani admin plugin with wget, unzipping archive..." << endl << endl;
			strcat (params, " && wget http://steamserverutil.googlecode.com/files/mani_admin_plugin_v1_2_beta_s_orange.zip && ");

			//to download mani admin plugin


			strcat(params, "unzip -o mani_admin_plugin_v1_2_beta_s_orange.zip ");
			//to unzip mani amdin plugin (unzips automatically in right folder)

			system(params);
		}
		else
		{
			cout << endl << endl << "Downloading mani admin plugin with wget, unzipping archive..." << endl << endl;
			strcat (params, " && wget http://steamserverutil.googlecode.com/files/mani_admin_plugin_v1_2_beta_s.zip && ");

			//to download mani admin plugin



			strcat(params, "unzip -o mani_admin_plugin_v1_2_beta_s.zip ");
			//to unzip mani amdin plugin (unzips automatically in right folder)

			system(params);

		}



		ofstream save_vdf;

		cout << "\n\nCreating mani_admin_plugin.vdf\n";
		
		strcat(param, "/addons/mani_admin_plugin.vdf");
		
		save_vdf.open(param); //right path
		
		//with choice right entry
		switch (server[choice])
		{

			case 1: 
				
				
				save_vdf << "\"Plugin\"\n";
				save_vdf << "{\n";
				save_vdf << " \"file\" \"../cstrike/addons/mani_admin_plugin\"\n";
				save_vdf << "}";
				break;

			case 2: 
				
				
				save_vdf << "\"Plugin\"\n";
				save_vdf << "{\n";
				save_vdf << " \"file\" \"../dod/addons/mani_admin_plugin\"\n";
				save_vdf << "}";
				break;
				
			case 3: 
				
				save_vdf << "\"Plugin\"\n";
				save_vdf << "{\n";
				save_vdf << " \"file\" \"../garrysmod/addons/mani_admin_plugin\"\n";
				save_vdf << "}";
				
				save_vdf.close();
				
				strcat(&param[strlen(param) - 29]/*to delete old path, see above*/, "/cfg/server.cfg");
				
				save_vdf.open(param, ios_base::app);
				
				save_vdf << "\n\nexec mani_server\n"; //needed otherwise gmod can not handle mani admin plugin
				break;

			case 4: 
		
				
				save_vdf << "\"Plugin\"\n";
				save_vdf << "{\n";
				save_vdf << " \"file\" \"../hl2mp/addons/mani_admin_plugin\"\n";
				save_vdf << "}";
				break;

			case 5:
				
				save_vdf << "\"Plugin\"\n";
				save_vdf << "{\n";
				save_vdf << " \"file\" \"../tf/addons/mani_admin_plugin\"\n";
				save_vdf << "}"; 
				break;



				default: never_happen();
				break;

		}
		
		save_vdf.close();


		cout << "\n\nMani Admin Plugin succesfully installed!\n";
			
	}
}

void install_quake()
{
	cout << "\n\nIn which server do you want to install the quake sound pack?\n\n";

	unsigned int choice;

	if(!is_installed())	
		return;

	cout << "\n : ";

	char params[300]; //the hole command is saved here

	cin >> choice;
	cin.ignore();



	strcpy (params, "cd "); //because in function mani_test the "cd " is not included

	//if it is really installed	
	installed = false;
	mani_test(server[choice]);
	strcat(params, param);
	//-------end---------(modified)
	
	//we dont need this, because the line is always in mani_server.cfg
	//char cfg_dir[200];
	//strcpy(cfg_dir ,param); //to add the required line to mani_server.cfg


	if(installed==true)
	{
		
			
		cout << endl << endl << "Downloading quake sound pack with wget, unzipping archive..." << endl << endl;
		strcat (params, " && wget http://steamserverutil.googlecode.com/files/quake_pack.zip && ");

			//to download mani admin plugin


		strcat(params, "unzip -o quake_pack.zip ");
			//to unzip mani amdin plugin (unzips automatically in right folder)
			
		system(params);
			
		cout << "\n\nquake sound pack succesfully installed!\n\n";

	}	
	
}

void deactivate_mani()
{
	cout << "\n\nFrom which server do you wish to deactivate the mani admin plugin? \n";
	
	if(!is_installed())
		return;

	unsigned short int choice;
	cout << "\n : ";
	
	cin >> choice;

	char params[100];


	strcpy(params, "cd "); //the "cd " is not include by mani_test(int)
	
	//if it is really installed	
	installed = false;
	mani_test(server[choice]);
	strcat(params, param);
	//-------end---------(modified)


	

	if(installed==true)
	{
		cout << "\n\nDeactivating mani admin plugin...\nDeleting mani_admin_plugin.vdf";
		strcat(params, " && rm -rf addons/mani_admin_plugin.vdf");


		system(params);
	}


}


void mani_admins()
{
	bool exit = false;


	char params[100];

	cout << "\n\nFrom which server do you want to manage the admins?\n";

	if(!is_installed())
		return;

	unsigned short int choice;
	cout << "\n : ";
	cin >> choice;

	//if it is really installed	
	installed = false;
	mani_test(server[choice]);
	strcpy(params, param);
	//-------end---------

	if(installed==true)
	{

		//copy old adminlist to the new one!
		char temp[200];
		strcpy(temp, "cd ");
		strcat(temp, params);
		strcat(temp, " && ");
		strcat(temp, "cp cfg/mani_admin_plugin/adminlist.txt.old cfg/mani_admin_plugin/adminlist.txt");
		system(temp);

		strcat(params, "/cfg/mani_admin_plugin/adminlist.txt");

		cout << endl << endl;

		while (!exit)
		{


			char input[50][2][200]; //OFF_N = 0 means name; OFF_C = 1 means steam id or ip
			
			ifstream in;
			in.open(params);


			int counter = 0;

			if(in.is_open())
			{

				cout << "\n\nCurrent admins: \n";
				
				while(!in.eof())
				{
					char temp[200];

					in.getline(temp, 200);


				
					switch(temp[0])
					{
						case 'S': if(!strncmp(temp, "STEAM", 5))
						{
							strcpy(input[counter][OFF_C], temp);
						}
						else
							cout << "\n\nCannot understand: " << temp << "\nIgnoring...";

						break;
						
						case ';': strcpy(input[counter][OFF_C], temp);
						break;
						case '/': if(!strncmp(temp, "//n: ", 5))
						{
							strcpy(input[counter][OFF_N], &temp[5]);
							cout << (counter+1) << ".\t" << input[counter][OFF_N] << endl;
							counter++;
						}
						break;
						default: 
							if(temp[0] == 10 || temp[0]== 0) //10 means new line 0 means end of string
							{
								//nothing to do
							}
							else
								cout << "\n\nCannot understand: " << temp << "\nIgnoring...";
					}
				}
			}
			else
			{
				cout << "\nNo admins. Please add one\n";
			
			}
			in.close();


			cout << "\n\n1. Add admin\n";
			cout << "2. Delete admin\n";
			cout << "3. Delte all admins\n";
			cout << "4. Exit\n";
			cout << " : ";

			cin >> choice;
			cin.ignore();


			char temp[200];

			ofstream out;
			out.open(params, ios_base::app);

			switch(choice)
			{
				case 1: 
					
					cout << "\n\nSteam ID or IP of the player? ";
					cin.getline(temp, 200);
					
					//test if steam id or ip
					if(!strncmp(temp, "STEAM", 5))
					{
						out << endl << temp << endl;
					}
					else
					{
						out << endl<< ";"<< temp << endl;
					}


					cout << "\nName or steam account of the player? ";
					cin.getline(temp, 200);
					out << "//n: " << temp;
					break;
					case 2: cout << "\n\nWhich admin do you want do delete? ";
					cin >> choice;
		
					choice--;

					if(choice >= counter)
					{
						cout << "\nThis entry does not exist!\n\n";
					}
					else
					{

						ofstream save_del;
						save_del.open(params);




						for (int i = 0;i<counter;i++)
						{

						
							if(i==choice)
							{
								//nothing to do
							}
							else
							{
								save_del << endl << input[i][OFF_C] ;
								save_del << "//n: " << input[i][OFF_C] << endl;
							}
							
						}
						save_del.close();
					}
					break;
					case 3: char temp;
					cout << "\n\nAll admins are going to be deleted. Are you sure?(y|n) ";
					cin >> temp;
				

					if(temp=='y')
					{
						ofstream del_all;
						del_all.open(params);
						del_all.close();
					}
					break;
					case 4: exit=true;
					break;
					default: cout << "\n\nTry again;)\n\n";
					break;
			}

			out.close();

		}
	}
}


void mani_wordfilter()
{
	bool exit=false;

	char params[100];

	cout << "\n\nFrom which server do you want to manage the admins?\n";

	if(!is_installed())
		return;

	unsigned short int choice;
	cout << "\n : ";
	cin >> choice;


	//if it is really installed	
	installed = false;
	mani_test(server[choice]);
	strcpy(params, param);
	//-------end---------



	if(installed==true)
	{


		strcat(params, "/cfg/mani_admin_plugin/wordfilter.txt");

		char filter[200][50];



		while(!exit)
		{

			int counter = 0;


			ifstream in;
			in.open(params);
		
			cout << "\nhere is your wordfilter:  \n";

			if(in.is_open())
			{
				while (!in.eof())
				{
					char temp[50];

					in.getline(temp, 50);

					switch(temp[0])
					{
						case '/': //nothing to do
							break;
						case 10: //nothing to do (10 means new line)
							break;
						case 0: //nothing to do (0 means end of string)
							break;
							default: strcpy(filter[counter], temp);
							cout << (counter + 1) << "\t" << filter[counter] << endl;
							counter++; 
							break;
					}
				}
			}
			else
				cout << "\nNo wordfilters. Please add one!\n";

			cout << "\n\n1. Add word\n";
			cout << "2. Delete word\n";
			cout << "3. Delete complete wordfilter\n";
			cout << "4. Exit\n";
			cout << " : ";
			cin >> choice;
			cin.ignore();

			switch (choice)
			{
				case 1: cout << "\nWord: ";
				{
					char temp[50];
					cin.getline(temp, 50);
					ofstream out;
					out.open(params, ios_base::app);
					out << endl << temp;
					out.close();
				}
				break;


				case 2: cout << "\n\nWhich word do you want do delete? ";
				cin >> choice;
		
				choice--;

				if(choice >= counter)
				{
					cout << "\nThis entry does not exist!\n\n";
				}
				else
				{

					ofstream save_del;
					save_del.open(params);




					for (int i = 0;i<counter;i++)
					{

						
						if(i==choice)
						{
								//nothing to do
						}
						else
						{
							save_del << endl << filter[i];
						}
							
					}
					save_del.close();
				}
				break;
				case 3: char temp;
				cout << "\n\nThe hole wordfilter is going to be deleted. Are you sure?(y|n) ";
				cin >> temp;
					

				if(temp=='y')
				{
					ofstream del_all;
					del_all.open(params);
					del_all.close();
				}
				break;
				case 4: exit=true;
				break;
				default: cout << "\n\nTry again;)\n\n";
				break;
			}
		}
		
	}

}

void mani_rcon()
{


	char params[200];
	bool exit = false;

	cout << "From which server do you wish to edit the rconlist?\n";

	if(!is_installed())
		return;

	unsigned short int choice;
	cout << "\n : ";
	cin >> choice;

	//if it is really installed	
	installed = false;
	mani_test(server[choice]);
	strcpy(params, param);
	//-------end---------

	char buf[50][2][100]; //OFF_name means 0, OFF_C means 1	


	

	if(installed==true)
	{

	
		strcat(params, "/cfg/mani_admin_plugin/rconlist.txt");
		


		


		while (!exit)
		{

			unsigned short int counter = 0;

			ifstream in;
			in.open(params);

			if(in.is_open())
			{
			

				cout << "\n\nCurrent rconlist: \n";


				while(!in.eof())
				{
					char temp[100];
					in.getline(temp, 100);
				
					switch(temp[0])
					{
						case '"': int i;
						for(i=1; i<100; i++)
						{
							if(temp[i]=='"')
								break;

							buf[counter][OFF_N][(i-1)] = temp[i];
						}

						buf[counter][OFF_N][(i-1)] = 0; //0 means end of string

						cout << (counter+1) << ".\t" << buf[counter][OFF_N] << endl;



						i+=2; //to junp over the '"' and over the ' '

						int j;
						for(j=0; i<100; i++, j++)
						{
							if((temp[i]=='/' && temp[(i+1)] == '/') || temp[i] == 0) //0 means end of string
								break;

							buf[counter][OFF_C][j] = temp[i];
						}

							  
						buf[counter][OFF_C][j] = 0; //0 means end of string

						counter++;
							  
						temp[0] = 0; //0 means end of string, to avoid the bug with the letter when temp[] = "\"\" "
							  
						break;
						
						case 10: //10 means new line
							//nothing to do
							break;
							case 0://0 means end of string
							//nothing to do
								break;
								case '/': if (temp [1] == '/')
										break;

										default: strcpy(buf[counter][OFF_N], temp);
										strcpy(buf[counter][OFF_C], temp);
							 
										cout << (counter+1) << ".\t" << buf[counter][OFF_N] << endl;
							 
										counter++;
							
					}

					if(counter > 49)
					{
						never_happen();
						cout << "\nToo many commands(>50)\n";
						break;
					}
				
				}

				in.close();

			}
		
			else
				cout << "\nYou have no rcon commands, please add one!\n";

		
		

			cout << "\n\n1. Add command\n";
			cout << "2. Delete command\n";
			cout << "3. Edit a command\n";
			cout << "4. Add Surf Mod Option\n";
			cout << "5. Delete hole list\n";
			cout << "6. Exit\n";


			cout << " : ";
			cin >> choice;
			cin.ignore();


			switch(choice)
			{
				case 1: cout << "\nCommand: ";
				{
					char command[50];
					cin.getline(command, 50);

					cout << "\nName: ";
					char name[50];
					cin.getline(name, 50);

					ofstream out;
					out.open(params, ios_base::app);
					out << endl << "\"" << name << "\"" << " " << command;
					out.close();
				}
				break;

			
				case 2: cout << "\n\nWhich entry do you want do delete? ";
				cin >> choice;
		
				choice--;

				if(choice >= counter)
				{
					cout << "\nThis entry does not exist!\n\n";
				}
				else
				{

					ofstream save_del;
					save_del.open(params);




					for (int i = 0;i<counter;i++)
					{

						
						if(i==choice)
						{
								//nothing to do
						}
						else
						{
							save_del << endl << "\"" << buf[i][OFF_N] << "\"" << " " << buf[i][OFF_C];
						}
							
					}
					save_del.close();
				}
				break;


				case 3:	cout << "\nWhich entry do you wish do edit? ";
				cin >> choice;
					
				choice--; //for thr right array


				if (choice >= counter)
				{
					cout << "\n\nThis entry does not exist!\n\n";
				}
				else
				{
					cout << "\n\n1. Edit the Name\n";
					cout << "2. Edit the command\n";
					cout << " : ";
					unsigned short int temp_e;
					cin >> temp_e;
					cin.ignore();

					if(temp_e > 2)
					{
						cout << "\n\nWrong choice!\n";
					}
					else
					{
						temp_e--;  //for the right array
						cout << "\nNew name/command: ";
						cin.getline(buf[choice][temp_e], 100);

	

						ofstream save_edit;
						save_edit.open(params);




						for (int i = 0;i<counter;i++)
							save_edit  << "\"" << buf[i][OFF_N] << "\"" << " " << buf[i][OFF_C] << endl;

				
						
					}

				}

				break;

				case 4: {
					ofstream surf;
					surf.open(params, ios_base::app);

					surf << "\n\"Surf Mod On\" sv_airaccelerate 2000\n";
					surf << "\"Surf Mod Off\" sv_airaccelerate 1";
					surf.close();


				}
				cout << "\nSucces!\n";
				break;

				case 5: char temp;
				cout << "\n\nThe hole rconlist is going to be deleted. Are you sure?(y|n) ";
				cin >> temp;
					

				if(temp=='y')
				{
					ofstream del_all;
					del_all.open(params);
					del_all.close();
				}
				break;
				case 6: exit = true;
				break;
				default: cout << "\n\nTry again;)\n";
			}
		}
	}
}

		
void mani_votequestionlist()
{
	char params[200];
	bool exit = false;

	cout << "From which server do you wish to edit the votequestionlist?\n";

	if(!is_installed())
		return;

	unsigned short int choice;
	cout << "\n : ";
	cin >> choice;

	//if it is really installed	
	installed = false;
	mani_test(server[choice]);
	strcpy(params, param);
	//-------end---------

	char buf[50][2][50]; //OFF_name means 0, OFF_C means 1	


	

	if(installed==true)
	{

	
		strcat(params, "/cfg/mani_admin_plugin/votequestionlist.txt");
		


		


		while (!exit)
		{

			unsigned short int counter = 0;

			ifstream in;
			in.open(params);

			if(in.is_open())
			{
				cout << "\n\nCurrent votequestionlist: \n";


				while(!in.eof())
				{
					char temp[100];
					in.getline(temp, 100);
				
					switch(temp[0])
					{
						case '"': int i;
						for(i=1; i<100; i++)
						{
							if(temp[i]=='"')
								break;

							buf[counter][OFF_N][(i-1)] = temp[i];
						}
							  
						buf[counter][OFF_N][i-1] = 0; //0 means end of string

						cout << (counter+1) << ".\t" << buf[counter][OFF_N] << endl;

							 

						i+=3; //to junp over the '"' and over the ' ' and the second '"'

						int j;
						for(j=0; i<100; i++, j++)
						{
							if(temp[i]=='"')
								break;

							buf[counter][OFF_C][j] = temp[i];
						}

							  
						buf[counter][OFF_C][j] = 0; //0 means end of string

							 // cout << buf[0][OFF_C] << " "  << buf[1][OFF_C];

						counter++;
							  
						temp[0] = 0; //0means end of string, to avoid the bug with the letter when temp[] = "\"\" "
							  
						break;
			

							
					}
				
				}

				in.close();
			}
		
			else
				cout << "\nYou have no votequestions, please add one!\n";






			cout << "\n\n1. Add question\n";
			cout << "2. Delete a question\n";
			cout << "3. Edit a question\n";
			cout << "4. Delete hole list\n";
			cout << "5. Exit\n";


			cout << " : ";
			cin >> choice;
			cin.ignore();


			switch(choice)
			{
				case 1: cout << "\nQuestion: ";
				{
					char question[50];
					cin.getline(question, 50);

					cout << "\nName: ";
					char name[50];
					cin.getline(name, 50);

					ofstream out;
					out.open(params, ios_base::app);
					out << endl << "\"" << name << "\"" << " \"" << question << "\"";
					out.close();
				}
				break;

			
				case 2: cout << "\n\nWhich entry do you want do delete? ";
				cin >> choice;
		
				choice--;

				if(choice >= counter)
				{
					cout << "\nThis entry does not exist!\n\n";
				}
				else
				{

					ofstream save_del;
					save_del.open(params);




					for (int i = 0;i<counter;i++)
					{

						
						if(i==choice)
						{
								//nothing to do
						}
						else
						{
							save_del << endl << "\"" << buf[i][OFF_N] << "\"" << " \"" << buf[i][OFF_C] << "\"";
						}
							
					}
					save_del.close();
				}
				break;


				case 3:	cout << "\nWhich entry do you wish do edit? ";
				cin >> choice;
					
				choice--; //for the right array


				if (choice < counter)
				{
					cout << "\n\nThis entry does not exist!\n\n";
				}
				else
				{
					cout << "\n\n1. Edit the Name\n";
					cout << "\n\n2. Edit the question\n";
					cout << " : ";
					unsigned short int temp_e;
					cin >> temp_e;

					if(temp_e > 2)
					{
						cout << "\n\nWrong choice!\n";
					}
					else
					{
						temp_e--;  //for the right array
						cout << "\nNew name/question: ";
						cin.getline(buf[choice][temp_e], 100);

	

						ofstream save_edit;
						save_edit.open(params);




						for (int i = 0;i<counter;i++)
							save_edit  << "\"" << buf[i][OFF_N] << "\"" << " \"" << buf[i][OFF_C] << "\"" << endl;

				
						
					}

				}

				break;

				case 4: char temp;
				cout << "\n\nThe hole votequestionlist is going to be deleted. Are you sure?(y|n) ";
				cin >> temp;
					

				if(temp=='y')
				{
					ofstream del_all;
					del_all.open(params);
					del_all.close();
				}
				break;
				case 5: exit = true;
				break;
				default: cout << "\n\nTry again;)\n";
				break;
		
			} //switch

		}//while(!exit)




	}//if(installed=true)
}




void mani_ping_reserve(int x)
{
	bool exit = false;


	//x = 1 means reserveslots, x = 2 means pingimmunity

	char params[100];

	cout << "\n\nFrom which server do you want to manage the ";
	
	if(x==1)
		cout << "reserveslots?\n";
	else
		cout << "pingimmunity\n";
	
	
	if(!is_installed())
		return;

	unsigned short int choice;
	cout << "\n : ";
	cin >> choice;


	//if it is really installed	
	installed = false;
	mani_test(server[choice]);
	strcpy(params, param);
	//-------end---------


	if(installed==true)
	{

		if(x==1)
			strcat(params, "/cfg/mani_admin_plugin/reserveslots.txt");
		else
			strcat(params, "/cfg/mani_admin_plugin/pingimmunity.txt");

		cout << endl << endl;

		while (!exit)
		{


			char input[50][2][200]; //OFF_N = 0 means name; OFF_C = 1 means steam id or ip
			
			ifstream in;
			in.open(params);


			int counter = 0;

			if(in.is_open())
			{

				cout << "\n\nCurrent ";
				
				if(x==1)
					cout << "reserveslots: \n";
				else
					cout << "pingimmunities: \n";
				
				while(!in.eof())
				{
					char temp[200];

					in.getline(temp, 200);


				
					switch(temp[0])
					{
						case 'S': if(!strncmp(temp, "STEAM", 5))
						{
							strcpy(input[counter][OFF_C], temp);
						}
						else
							cout << "\n\nCannot understand: " << temp << "\nIgnoring...\n";

						break;
						
						case '/': if(!strncmp(temp, "//n: ", 5))
						{
							strcpy(input[counter][OFF_N], &temp[5]);
							cout << (counter+1) << ".\t" << input[counter][OFF_N] << endl;
							counter++;
						}
						break;
						default: 
							if(temp[0] == 10 || temp[0]== 0 || temp[0] == 13) //10 means new line 0 means end of string 13 means "\r"
							{
								//nothing to do
							}
							else
								cout << "\n\nCannot understand: " << temp << "\nIgnoring...\n";

							break;
					}
	
					if(counter > 50)
					{
						never_happen();
						cout << "\nToo many entrys (>50)\n";
						break;
					}
				}
			}
			else
			{
				cout << "\nNo entrys. Please add one\n";
			
			}
			in.close();


			cout << "\n\n1. Add a person\n";
			cout << "2. Delete a person\n";
			cout << "3. Delte all persons\n";
			cout << "4. Exit\n";
			cout << " : ";

			cin >> choice;
			cin.ignore();


			char temp[200];

			ofstream out;
			out.open(params, ios_base::app);

			switch(choice)
			{
				case 1: 
					
					cout << "\n\nSteam ID of the player? ";
					cin.getline(temp, 200);
					
					
					out << endl << temp << endl;


					cout << "\nName or steam account of the player? ";
					cin.getline(temp, 200);
					out << "//n: " << temp;
					break;
					case 2: cout << "\n\nWhich person do you want do delete? ";
					cin >> choice;
		
					choice--;

					if(choice >= counter)
					{
						cout << "\nThis entry does not exist!\n\n";
					}
					else
					{

						ofstream save_del;
						save_del.open(params);




						for (int i = 0;i<counter;i++)
						{

						
							if(i==choice)
							{
								//nothing to do
							}
							else
							{
								save_del << endl << input[i][OFF_C] ;
								save_del << "//n: " << input[i][OFF_C] << endl;
							}
							
						}
						save_del.close();
					}
					break;
					case 3: char temp;
					cout << "\n\nAll persons are going to be deleted. Are you sure?(y|n) ";
					cin >> temp;
				

					if(temp=='y')
					{
						ofstream del_all;
						del_all.open(params);
						del_all.close();
					}
					break;
					case 4: exit=true;
					break;
					default: cout << "\n\nTry again;)\n\n";
					break;
			}

			out.close();

		}
	}
}

void mani_resw()
{
	cout << "\n\nThis option is only supported by the Counter Strike Source Server\n";

	

	bool exit = false;

	while(!exit)
	{


		ifstream in;
		in.open("server_css/cstrike/cfg/mani_admin_plugin/default_weapon_restrict.txt");


		int counter = 0;
		char resw[50][15];

		cout << "\nCurrent restricted weapons: \n\n";

		if (in.is_open())
		{
			while(!in.eof())
			{
				char temp[100];
				in.getline(temp, 100);
				
				if(temp[0] == '/' && temp[1] == '/')
					continue;

				if(temp[0] == 10 || temp[0]== 0 || temp[0] == 13) //10 means new line 0 means end of string 13 means "\r"
					continue;

				

				if(!strncmp(temp, "awp", 3))
					cout << (counter+1) << ".\tMagnum Sniper Rifle(awp)\n";

				if(!strncmp(temp, "g3sg1", 5))
					cout << (counter+1) << ".\tD3/AU1\n";

				if(!strncmp(temp, "sg550", 5))
					cout << (counter+1) << ".\tKrieg 550 Commando\n";

				if(!strncmp(temp, "galil", 5))
					cout << (counter+1) << ".\tIDF Defender(galil)\n";

				if(!strncmp(temp, "ak47", 4))
					cout << (counter+1) << ".\tCV-47(AK-47)\n";
				
				if(!strncmp(temp, "scout", 5))
					cout << (counter+1) << ".\tSchmidt Scout\n";

				if(!strncmp(temp, "sg552", 5))
					cout << (counter+1) << ".\tKrieg 552\n";

				if(!strncmp(temp, "famas", 5))
					cout << (counter+1) << ".\tClarion 5.56(famas)\n";

				if(!strncmp(temp, "m4a1", 4))
					cout << (counter+1) << ".\tMaverick M4A1 Carbine(m4a1)\n";	

				if(!strncmp(temp, "aug", 3))
					cout << (counter+1) << ".\tBullpup\n";

				if(!strncmp(temp, "glock", 5))
					cout << (counter+1) << ".\t9x19mm Sidearm(glock)\n";

				if(!strncmp(temp, "usp", 3))
					cout << (counter+1) << ".\tKM .45 Tactical(usp)\n";

				if(!strncmp(temp, "p228", 4))
					cout << (counter+1) << ".\t228 Compact\n";

				if(!strncmp(temp, "deagle", 6))
					cout << (counter+1) << ".\tNight Hawk .50C(deagle)\n";

				if(!strncmp(temp, "elite", 5))
					cout << (counter+1) << ".\t.40 Dual Elites\n";

				if(!strncmp(temp, "fiveseven", 9))
					cout << (counter+1) << ".\tES Five//Seven\n";

				if(!strncmp(temp, "m3", 2))
					cout << (counter+1) << ".\tLeone 12 Gauge Super(m3)\n";

				if(!strncmp(temp, "xm1014", 6))
					cout << (counter+1) << ".\tLeone YG1265 Auto Shotgun\n";

				if(!strncmp(temp, "mac10", 5))
					cout << (counter+1) << ".\tIngram MAC-10\n";

				if(!strncmp(temp, "tmp", 3))
					cout << (counter+1) << ".\tSchmidt Machine Pistol(tmp)\n";

				if(!strncmp(temp, "mp5navy", 7))
					cout << (counter+1) << ".\tKM Sub-Machine Gun(mp5)\n";

				if(!strncmp(temp, "ump45", 5))
					cout << (counter+1) << ".\tKM UMP45\n";

				if(!strncmp(temp, "p90", 3))
					cout << (counter+1) << ".\tES C90\n";

				if(!strncmp(temp, "m249", 4))
					cout << (counter+1) << ".\tM249\n";

				if(!strncmp(temp, "flashbang", 9))
					cout << (counter+1) << ".\tFlashbang\n";

				if(!strncmp(temp, "hegrenade", 9))
					cout << (counter+1) << ".\tHE Grenade\n";

				if(!strncmp(temp, "smokegrenade", 12))
					cout << (counter+1) << ".\tSmoke Grenade\n";

				strncpy(resw[counter], temp, 15);

				counter++;
			}
		}
		else
			cout << "No restricted weapons found. Please add one";


		cout << "\n\n1. Add a weapon\n";
		cout << "2. Delete a waepon\n";
		cout << "3. Delete all\n";
		cout << "4. Exit\n";
		cout << " : ";
		unsigned short int choice;

		cin >> choice;

		switch(choice)
		{
			case 1: 


				


				cout << "\n\nWhich weapon should be restricted?\n\n";

				cout << "1.  Magnum Sniper Rifle(awp)\n";
				cout << "2.  D3/AU1\n";
				cout << "3.  Krieg 550 Commando\n";
				cout << "4.  IDF Defender\n";
				cout << "5.  CV-47(AK -47)\n";
				cout << "6.  Schmidt Scout\n";
				cout << "7.  Krieg 552\n";
				cout << "8.  Clarion 5.56(famas)\n";
				cout << "9.  Maverick M4A1 Carbine(m4a1)\n";
				cout << "10. Bullpup\n";
				cout << "11. 9x19mm Sidearm(glock)\n";
				cout << "12. KM .45 Tactical(usp)\n";
				cout << "13. 228 Compact\n";
				cout << "14. Night Hawk .50C(deagle)\n";
				cout << "15. .40 Dual Elites\n";
				cout << "16. ES Five//Seven\n";
				cout << "17. Leone 12 Gauge Super(m3)\n";
				cout << "18. Leone YG1265 Auto Shotgun\n";
				cout << "19. Ingram MAC-10\n";
				cout << "20. Schmidt Machine Pistol(tmp)\n";
				cout << "21. KM Sub-Machine Gun(mp5)\n";
				cout << "22. KM UMP45\n";
				cout << "23. ES C90\n";
				cout << "24. M249\n";
				cout << "25. Flashbang\n";
				cout << "26. HE Grenade\n";
				cout << "27. Smoke Grenade\n";

				cout << " : ";
				cin >> choice;

				

				{
					ofstream add;
					add.open("server_css/cstrike/cfg/mani_admin_plugin/default_weapon_restrict.txt", ios_base::app);
				
					switch(choice)
					{
						case 1: add << endl << "awp";
						break;
						case 2: add << endl << "g3sg1";
						break;
						case 3: add << endl << "sg550";
						break;
						case 4: add << endl << "galil";
						break;
						case 5: add << endl << "ak47";
						break;
						case 6: add << endl << "scout";
						break;
						case 7: add << endl << "sg552";
						break;
						case 8: add << endl << "famas";
						break;
						case 9: add << endl << "m4a1";
						break;
						case 10: add << endl << "aug";
						break;
						case 11: add << endl << "glock";
						break;
						case 12: add << endl << "usp";
						break;
						case 13: add << endl << "p228";
						break;
						case 14: add << endl << "deagle";
						break;
						case 15: add << endl << "elite";
						break;
						case 16: add << endl << "fiveseven";
						break;
						case 17: add << endl << "m3";
						break;
						case 18: add << endl << "xm1014";
						break;
						case 19: add << endl << "mac10";
						break;
						case 20: add << endl << "tmp";
						break;
						case 21: add << endl << "mp5navy";
						break;
						case 22: add << endl << "ump45";
						break;
						case 23: add << endl << "p90";
						break;
						case 24: add << endl << "m249";
						break;
						case 25: add << endl << "flashbang";
						break;
						case 26: add << endl << "hegrenade";
						break;
						case 27: add << endl << "smokegrenade";
						break;
						default: cout << "\nWrong choice!\n\n";
					}

					add.close();

				}

				break;
				case 2: cout << "\n\nWhich entry do you wish to delete? ";
				cin >> choice;

				choice--;

				if(choice >= counter)
					cout << "\n\nEntry does not exist!\n";

				else
				{
					ofstream out;
					out.open("server_css/cstrike/cfg/mani_admin_plugin/default_weapon_restrict.txt");

					for(int i = 0; i<counter; i++)
					{
						if(i==choice);	//nothing to do
						
						else
						{
							out << resw[i] << endl;
						}
						
					}
					out.close();
				}
				break;
				case 3: char temp;
				cout << "\n\nThe hole voterconlist is going to be deleted. Are you sure?(y|n) ";
				cin >> temp;
				

				if(temp=='y')
				{
					ofstream del_all;
					del_all.open("server_css/cstrike/cfg/mani_admin_plugin/default_weapon_restrict.txt");
					del_all.close();
				}
				break;
				case 4: exit =true;
				break;
				default: cout << "\n\nTry again ;)\n";
		}



	}
}


void mani_voterconlist()
{
	
	char params[200];
	bool exit = false;

	cout << "From which server do you wish to edit the rconlist?\n";

	if(!is_installed())
		return;

	unsigned short int choice;
	cout << "\n : ";
	cin >> choice;

	//if it is really installed	
	installed = false;
	mani_test(server[choice]);
	strcpy(params, param);
	//-------end---------

	char buf[50][3][50]; //OFF_name means 0, OFF_C menas 1, 2 is the question





	if(installed==true)
	{

	
		strcat(params, "/cfg/mani_admin_plugin/voterconlist.txt");
		


		


		while (!exit)
		{

			unsigned short int counter = 0;

			ifstream in;
			in.open(params);

			if(in.is_open())
			{
			

				cout << "\n\nCurrent voterconlist: \n";


				while(!in.eof())
				{
					char temp[150];
					in.getline(temp, 150);
				
					switch(temp[0])
					{
						case '"': int i;
						for(i=1; i<150; i++)
						{
							if(temp[i]=='"')
								break;

							buf[counter][OFF_N][(i-1)] = temp[i];
						}
							  
						buf[counter][OFF_N][i] = 0; //0 means end of string
							  
						cout << (counter+1) << ".\t" << buf[counter][OFF_N] << endl;

							  

						i+=3; //to junp over the '"' and over the ' ' and the second '"'

						int q;
						for(q=0; i<150; i++, q++)
						{
							if(temp[i]=='"')
								break;

							buf[counter][2][q] = temp[i];
						}

						i+=2; //to junp over the '"' and over the ' '

						int j;
						for(j=0; i<150; i++, j++)
						{
							if((temp[i]=='/' && temp[(i+1)] == '/') || temp[i]==0) //0 means end of string
								break;

							buf[counter][OFF_C][j] = temp[i];
						}

							 
						buf[counter][OFF_C][j] = 0; //0 means end of string
						buf[counter][2][q] = 0; //0 means end of string

							  //2 is space for the question

						counter++;
							  
						temp[0] = 0; //0means end of string, to avoid the bug with the letter when temp[] = "\"\" "
							  
						break;
			

							
					}
				
				}

				in.close();

			}
		
			else
				cout << "\nYou have no rcon questions, please add one!\n";

		
		

			cout << "\n\n1. Add command\n";
			cout << "2. Delete command\n";
			cout << "3. Edit a command\n";
			cout << "4. Delete hole list\n";
			cout << "5. Exit\n";


			cout << " : ";
			cin >> choice;
			cin.ignore();


			switch(choice)
			{
				case 1: cout << "\nCommand: ";
				{
					char command[50];
					cin.getline(command, 50);

					cout << "\nName: ";
					char name[50];
					cin.getline(name, 50);

					cout << "\nQuestion: ";
					char question[100];
					cin.getline(question, 100);

					ofstream out;
					out.open(params, ios_base::app);
					out << endl << "\"" << name << "\"" << " \"" << question << "\" " << command;
					out.close();
				}
				break;

			
				case 2: cout << "\n\nWhich entry do you want do delete? ";
				cin >> choice;
		
				choice--;

				if(choice >= counter)
				{
					cout << "\nThis entry does not exist!\n\n";
				}
				else
				{

					ofstream save_del;
					save_del.open(params);




					for (int i = 0;i<counter;i++)
					{

						
						if(i==choice)
						{
								//nothing to do
						}
						else
						{
							save_del << endl << "\"" << buf[i][OFF_N] << "\"" << " \"" << buf[i][2] << "\" " << buf[i][OFF_C];

								//2 is space for the question
						}
							
					}
					save_del.close();
				}
				break;


				case 3:	cout << "\nWhich entry do you wish do edit? ";
				cin >> choice;
					
				choice--; //for the right arry


				if (choice >= counter)
				{
					cout << "\n\nThis entry does not exist!\n\n";
				}
				else
				{
					cout << "\n\n1. Edit the Name\n";
					cout << "2. Edit the command\n";
					cout << "3. Edit the question\n";
					cout << " : ";
					unsigned short int temp_e;
					cin >> temp_e;

						

					if(temp_e > 3)
					{
						cout << "\n\nWrong choice!\n";
					}
					else
					{

						temp_e--;  //for the right array
						cout << "\nNew name/command/question: ";
						cin.getline(buf[choice][temp_e], 100);

	

						ofstream save_edit;
						save_edit.open(params);




						for (int i = 0;i<counter;i++)
							save_edit << "\"" << buf[i][OFF_N] << "\"" << " \"" << buf[i][2] << "\" " << buf[i][OFF_C] << endl;

				
						
					}

				}

				break;

				case 4: char temp;
				cout << "\n\nThe hole voterconlist is going to be deleted. Are you sure?(y|n) ";
				cin >> temp;
					

				if(temp=='y')
				{
					ofstream del_all;
					del_all.open(params);
					del_all.close();
				}
				break;
				case 5: exit = true;
				break;
				default: cout << "\n\nTry again;)\n";
			}
		}
	}
}

void edit_manicfg(int i)//i == 1 -> mani_Server.cfg; i == 2 -> mani_quake_sounds.cfg
{
	cout << "\n\nFrom which server do you wish to edit the ";
			
	if(i==1)
		cout << "mani_server.cfg?\n";
	else
		cout << "mani_quake_sounds.cfg?\n";
		

	if(!is_installed())
		return;

	unsigned short int choice;
	cout << "\n : ";
	cin >> choice;
	
	char params[100];

	//if it is really installed	
	installed = false;
	mani_test(server[choice]);
	strcpy(params, param);
	//-------end---------
	
	if(i == 1)
		strcat(params, "/cfg/mani_server.cfg");
	else
		strcat(params, "/cfg/mani_quake_sounds.cfg");
	
	
	
	cout << "\n\nWhich editor do you wish to edit the mani_server.cfg\n";
	cout << "1. Nano\n";
	cout << "2. Vim\n";
	cout << "3. Specify Editor\n";
	cout << " : ";
	
	cin >> choice;
	cin.ignore();
	
	switch (choice)
	{
		case 1: strcpy(param, "nano ");
		strcat(param, params);
		system(param);
			//using param because it is more efficent
		break;
		case 2: strcpy(param, "vim ");
		strcat(param, params);
		system(param);
			//using param because it is more efficent
		break;
		case 3: cout << "Command for the editor you want to use?(eg. nano, vim, kate, kwrite, gedit) ";
		char temp[20];
		cin.getline(temp, 20);
		strcpy(param, temp);
		strcat(param, " ");
		strcat(param, params);
		system(param);
			//using param because it is more efficent
		break;
		default: cout << "\n\nWrong choice!\n\n";
		break;
	}
}

void mani_sounds(int i)
{
	
	//1 means quakesoundlist.txt
	//2 means actionsoundlist.txt
	//3 means soundlist.txt



	char params[200];
	bool exit = false;

	
	cout << "From which server do you wish to edit the ";
			
	
	if(i == 1)
		cout << "quakesoundlist?\n";
	if(i == 2)
		cout << "actionsoundlist?\n";
	if(i == 3)
		cout << "soundlist?\n";

	if(!is_installed())
		return;

	unsigned short int choice;
	cout << "\n : ";
	cin >> choice;

	//if it is really installed	
	installed = false;
	mani_test(server[choice]);
	strcpy(params, param);
	//-------end---------

	char buf[50][2][100]; //OFF_name means 0, OFF_C means 1	


	

	if(installed==true)
	{

		if(i == 1)
			strcat(params, "/cfg/mani_admin_plugin/quakesoundlist.txt");
		
		if(i == 2)
			strcat(params, "/cfg/mani_admin_plugin/actionsoundlist.txt");
		
		if(i == 3)
			strcat(params, "/cfg/mani_admin_plugin/soundlist.txt");
		


		


		while (!exit)
		{

			unsigned short int counter = 0;

			ifstream in;
			in.open(params);

			if(in.is_open())
			{
			

				cout << "\n\nCurrent list: \n";


				while(!in.eof())
				{
					char temp[100];
					in.getline(temp, 100);
				
					switch(temp[0])
					{
						case '"': int i;
						for(i=1; i<100; i++)
						{
							if(temp[i]=='"')
								break;

							buf[counter][OFF_N][(i-1)] = temp[i];
						}

						buf[counter][OFF_N][(i-1)] = 0; //0 means end of string

						cout << (counter+1) << ".\t" << buf[counter][OFF_N] << endl;



						i++; //to junp over the '"' and over the ' '

						int j;
						for(j=0; i<100; i++, j++)
						{
							if((temp[i]=='/' && temp[(i+1)] == '/') || temp[i] == 0) //0 means end of string
								break;

							buf[counter][OFF_C][j] = temp[i];
						}

							  
						buf[counter][OFF_C][j] = 0; //0 means end of string

						counter++;
							  
						temp[0] = 0; //0 means end of string, to avoid the bug with the letter when temp[] = "\"\" "
							  
						break;
						
						case 10: //10 means new line
						//nothing to do
							break;
							case 13://13 means return ( '/r' )
						//nothing to do
								break;
								case '/': if (temp [1] == '/');
								else
									cout << "\n\nCannot understand " << temp << "\nIgnoring...\n";
								break;
								case 0: break; //nothing to do, 0 means end of string

								default:cout << "\n\nCannot understand " << temp << "\nIgnoring...\n";
								break;
							
					}

					if(counter > 49)
					{
						never_happen();
						cout << "\nToo many sounds(>50)\n";
						break;
					}
				
				}

				in.close();

			}
		
			else
				cout << "\nYou have no sounds, please add one!\n";

		
		

			cout << "\n\n1. Add sound\n";
			cout << "2. Delete sound\n";
			cout << "3. Edit a sound\n";
			cout << "4. Delete hole list\n";
			cout << "5. Exit\n";


			cout << " : ";
			cin >> choice;
			cin.ignore();


			switch(choice)
			{
				case 1: cout << "\nPath: ";
				{
					char path[50];
					cin.getline(path, 50);

					cout << "\nName: ";
					char name[50];
					cin.getline(name, 50);

					ofstream out;
					out.open(params, ios_base::app);
					out << endl << "\"" << name << "\"" << " " << path;
					out.close();
				}
				break;

			
				case 2: cout << "\n\nWhich entry do you want do delete? ";
				cin >> choice;
		
				choice--;

				if(choice >= counter)
				{
					cout << "\nThis entry does not exist!\n\n";
				}
				else
				{

					ofstream save_del;
					save_del.open(params);




					for (int i = 0;i<counter;i++)
					{

						
						if(i==choice)
						{
								//nothing to do
						}
						else
						{
							save_del << endl << "\"" << buf[i][OFF_N] << "\"" << " " << buf[i][OFF_C];
						}
							
					}
					save_del.close();
				}
				break;


				case 3:	cout << "\nWhich entry do you wish do edit? ";
				cin >> choice;
					
				choice--; //for thr right array


				if (choice >= counter)
				{
					cout << "\n\nThis entry does not exist!\n\n";
				}
				else
				{
					cout << "\n\n1. Edit the Name\n";
					cout << "2. Edit the path\n";
					cout << " : ";
					unsigned short int temp_e;
					cin >> temp_e;
					cin.ignore();

					if(temp_e > 2)
					{
						cout << "\n\nWrong choice!\n";
					}
					else
					{
						temp_e--;  //for the right array
						cout << "\nNew name/path: ";
						cin.getline(buf[choice][temp_e], 100);

	

						ofstream save_edit;
						save_edit.open(params);




						for (int i = 0;i<counter;i++)
							save_edit  << "\"" << buf[i][OFF_N] << "\"" << " " << buf[i][OFF_C] << endl;

				
						
					}

				}

				break;

				case 4: char temp;
				cout << "\n\nThe hole list is going to be deleted. Are you sure?(y|n) ";
				cin >> temp;
					

				if(temp=='y')
				{
					ofstream del_all;
					del_all.open(params);
					del_all.close();
				}
				break;
				case 5: exit = true;
				break;
				default: cout << "\n\nTry again;)\n";
			}
		}
	}
}



void config_mani()
{

	bool exit = false;

	while(!exit)
	{
		cout << "\n\n1.  Install mani admin plugin\n";
		cout << "2.  Install quake sound pack\n";
		cout << "3.  Deactivate mani admin plugin\n";
		cout << "4.  Configure Admins\n";
		cout << "5.  Configure votemapslist\n";
		cout << "6.  Configure wordfilter\n";
		cout << "7.  Configure rconlist\n";
		cout << "8.  Configure votequestionlist\n";
		cout << "9.  Configure reserveslots\n";
		cout << "10. Configure pingimmunities\n";
		cout << "11. Configure restricted weapons\n";
		cout << "12. Configure voterconlist\n";
		cout << "13. Edit mani_server.cfg (main config for mani admin plugin)\n";
		cout << "14. Edit mani_quake_sounds.cfg (main config for the quake sounds)\n";
		cout << "15. Configure quake sounds\n";
		cout << "16. Configure actionsoundlist\n";
		cout << "17. Configure soundlist\n";
		cout << "18. Exit\n";
		cout << " : ";

		unsigned short int choice;
		cin >> choice;
		cin.ignore();

		switch (choice)
		{
			case 1: install_mani();
			break;
			case 2: install_quake();
			break;
			case 3:	deactivate_mani();
			break;
			case 4: mani_admins();
			break;
			case 5: edit_mapcl(3); //3 means votemaplist.txt
			break;
			case 6: mani_wordfilter();
			break;
			case 7: mani_rcon();
			break;
			case 8: mani_votequestionlist();
			break;
			case 9: mani_ping_reserve(1); //1 means reserveslots
			break;
			case 10: mani_ping_reserve(2); //2 means pingimmunity
			break;
			case 11: mani_resw();
			break;
			case 12: mani_voterconlist();
			break;
			case 13: edit_manicfg(1); //1 means mani_server.cfg
			break;
			case 14: edit_manicfg(2); //2 means mani_quake_sounds.cfg
			break;
			case 15: mani_sounds(1); //1 means quakesoundlist.txt
			break;
			case 16: mani_sounds(2); //2 means actionsoundlist.txt
			break;
			case 17: mani_sounds(3); //3 means soundlist.txt
			break;
			case 18: exit = true;
			break;
			default: cout << "\n\nTry again;)\n";
		}
	}
}
